package net.wzw.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.wzw.mapper.db_counter.FoodCounterMapper;
import net.wzw.model.FoodCounterDO;
import net.wzw.service.FoodCounterService;
import net.wzw.vo.FoodCounterVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author wzw
 * @date 2025/5/1
 * @Description
 */
@Service
@Slf4j
@RequiredArgsConstructor
public class FoodCounterServiceImpl implements FoodCounterService {

    @Autowired
    private FoodCounterMapper foodCounterMapper;

    /**
     * 获取美食计数信息
     * **/
    @Override
    public List<FoodCounterVO> getFoodCpunter(Long foodId) {

       List<FoodCounterVO> foodCounterVOS =  foodCounterMapper.getFoodCountersById(foodId.intValue());
       log.info("社交微服务计数模块-getFoodCounter,foodId:{},foodCounterVOs:{}",foodId,foodCounterVOS);
       return foodCounterVOS;
    }

    @Override
    public void delFoodCounter(Long foodId) {

        foodCounterMapper.delete(new QueryWrapper<FoodCounterDO>().eq("food_id",foodId));
    }
}
